#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "block_queue.h"
#include "hash.h"



int main(int argc ,char * argv[]){
     char * name = "sohu.com"; 
     unsigned int hashcode = (unsigned int)hash(name,strlen(name));
     printf("hashcode:%d\n",hashcode);


     hash_t *hash = hash_init(10);
     printf("init done!\n");
     hash_push(hash,"sohu","http://www.sohu.com/adfa");
     hash_push(hash,"youku","http://www.youku.com/adfa");
     hash_push(hash,"ku6","http://www.ku6.com/adfa1");
     hash_push(hash,"ku6","http://www.ku6.com/adfa2");
     hash_push(hash,"ku6","http://www.ku6.com/adfa3");
     hash_push(hash,"letv","http://www.letv.com/adfa");
     hash_push(hash,"qiyi","http://www.qiyi.com/adfa");
     hash_push(hash,"tudou","http://www.tudou.com/adfa");
     hash_push(hash,"56","http://www.56.com/adfa");
   
     printf("hash element count:%d\n",hash->count);
 
     char *val = (char*)hash_find(hash,"ku6"); 
     printf("hash find key:sohu value:%s\n",val); 

     hash_iter_t iter;
     hash_iter_init(hash,&iter);
     hash_elt_t *elt = NULL;
     while((elt=hash_iter_next(&iter))!=NULL){
    	 printf("%p\n",elt);
    	 printf("name %s:%s\n",elt->name,(char*)elt->data);
     }
     return 0;
}
